﻿using Service.Repository;
using SqlSugar;

namespace Service.Gateway.Domain.Db
{
    [SugarTable("tb_apigateway_config")]
    public class ApiGatewayConfiguration : Entity<long>, IAggregateRoot
    {
        public ApiGatewayConfiguration()
        {
        }

        public ApiGatewayConfiguration(string routeId, string routeName)
        {
            RouteId = routeId;
            RouteName = routeName;
            // AddDomainEvent(new ChangeGatewayDomainEvent());
        }

        /// <summary>
        /// 网关标识
        /// </summary>
        [SugarColumn(ColumnName = "route_id")]
        public string RouteId { get; private set; }

        /// <summary>
        /// 网关名称
        /// </summary>
        [SugarColumn(ColumnName = "route_name")]
        public string RouteName { get; private set; }

        /// <summary>
        /// 路由
        /// </summary>
        [Navigate(NavigateType.OneToMany, nameof(ServiceRoute.GatewayId))]
        public List<ServiceRoute> ServiceRoutes { get; private set; }

    }
}